<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@include file="../static/header.jsp" %>
<script type="text/javascript">
    $(document).ready(function() {
 
        $("#create_invitation").addClass("selected");
        
        $("#firma").change(function() {
            
            var id = $(this).val();
            
            if ( id == 0 ){
                return false;
            }
            
            $('#account input[name="id_f"]').val(id);
            $('#submit').removeAttr('disabled');

            $.ajax({
              url: "data/firma.htm",
              type:'POST',
              dataType: 'json',
              data: {id_f:id},
              success: function( data ){
                 
                  $("._001first_name").text(data.firstName);
                  $("._001last_name").text(data.lastName);
                  $("._001email").text(data.email);
                  $("._001contry").text(data.country);
                  $("._001tel").text(data.tel);
                  $("._001city").text(data.city);
                  $("._001street").text(data.street);
                  $("._001number").text(data.number);
                  
                  
                  //console.log(data.accounts.idAccount);
                  $('#account input[name="id_a"]').val(data.idAccoun);
                  
              }
            });
        });
        
        $("#submit").attr("disabled",true);
        
        $("#dateStartFirma").mask("9999-99-99");
        
    });
</script>


    <table cellpadding="5" cellspacing="0" border="0" width="60%" align="center">
        <tbody>
            <tr>
                <td  align="center" id="td_body">

                    <fieldset>

                        <legend id="legend_galery">Dane firmy
<!--                                < spring:message code="create_invitation" />-->
                        </legend>

                        
                        <div id="label_text">Firmy
<!--                            < spring :message code="assigned.to.user"/>-->
                        </div>
                        <div id="field_object">
                            <form:form modelAttribute="account" method="POST" >
                                <!--
                              < form : select path="firma" items="${list_firm}" multiple="false">< / form :select>
                           -->
                                <form:select path="firma">
                                    <form:option value="0" label="Firma" />
                                    <form:options items="${list_firm}" itemValue="idFirma" itemLabel="name" />
                                </form:select>
                              
                             </form:form>
                             <%--
                                <c:forEach items="${list_firm}" var="fi">
                                        <c:out value="${fi.firstName}"/>
                                </c:forEach>
                            --%>
                        </div>
                        
                        <div id="label_text">Imie
<!--                            < spring :message code="assigned.to.user"/>-->
                        </div>
                        <div id="field_object" class="_001first_name"></div>
                        
                        
                        <div id="label_text">Nazwisko
<!--                            < spring :message code="assigned.to.user"/>-->
                        </div>
                        <div id="field_object" class="_001last_name"></div>
                        
                        
                        <div id="label_text">Email
<!--                            < spring :message code="assigned.to.user"/>-->
                        </div>
                        <div id="field_object" class="_001email"></div>
                        
                        
                        <div id="label_text">Tel.
<!--                            < spring :message code="assigned.to.user"/>-->
                        </div>
                        <div id="field_object" class="_001tel"></div>
                        
                        
                        <div id="label_text">Kraj
<!--                            < spring:message code="theme"/>-->
                        </div>
                        <div id="field_object" class="_001contry"></div>
                        
                        
                        <div id="label_text">Miasto
<!--                            < /spring :message code="description"/>-->
                        </div>
                        <div id="field_object" class="_001city"></div>
                        
                        
                        <div id="label_text">Ulica
<!--                            < spring :message code="assigned.to.user"/>-->
                        </div>
                        <div id="field_object" class="_001street"></div>
                        
                        
                        <div id="label_text">Numer
<!--                            < spring :message code="assigned.to.user"/>-->
                        </div>
                        <div id="field_object" class="_001number"></div>
                        
                        
                    </fieldset>
                </td>
            </tr>
        </tbody>
    </table> 
    <br>


<form:form modelAttribute="account" method="POST" >
<table cellpadding="5" cellspacing="0" border="0" width="60%" align="center">
    <input type="hidden" name="id_f" id="id_f" value="0"/>
    <input type="hidden" name="id_a" id="id_a" value="0"/>
        <tbody>
            <tr>
                <td  align="center" id="td_body">

                    <fieldset>

                        <legend id="legend_galery">
                            Trść do wysłania
<!--                                < spring:message code="create_invitation" />-->
                        </legend>

                        
                        <div id="label_text">Data startu
                            
                        </div>
                        <div id="field_object">
                         
                            <form:input path="dateStartFirma" cols="70" rows="4"/>
                        </div>
                        
                        <div id="label_text">Notatka
<!--                            < spring :message code="assigned.to.user"/>-->
                        </div>
                        <div id="field_object">
                            <form:textarea path="note" cols="70" rows="4"/>
<!--                            <font color="red">< form :errors path="note" cssClass="errors"/></font>-->
                        </div>
                        
                        <div id="label_text">Treść meila
<!--                            < spring :message code="assigned.to.user"/>-->
                        </div>
                        <div id="field_object">
                           <form:textarea path="content.description" cols="70" rows="4"/>
                           <font color="red"><form:errors path="content.description" cssClass="errors"/></font>
                        </div>
                        
                        <div id="field_simple">
                            <input  type="submit" value="Zapisz" id="submit" />
                        </div>
                    </fieldset>
                </td>
            </tr>
        </tbody>
    </table> 
    <br>
</form:form>

<!-- END LOGIN -->
<%@include file="../static/footer.jsp" %>